package io.dcloud.h527baaa6.activity;

import android.content.Context;
import android.content.Intent;

import butterknife.BindView;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayer;
import fm.jiecao.jcvideoplayer_lib.JCVideoPlayerStandard;
import io.dcloud.h527baaa6.R;
import io.dcloud.h527baaa6.base.BaseActivity;
import io.dcloud.h527baaa6.bean.XmlBean;

public class VideoActivity extends BaseActivity {

    @BindView(R.id.videoplayer)
    JCVideoPlayerStandard mVideoplayer;

    private XmlBean.DataBean.ItemListBean mItemListBean;

    public static void startActivity(Context context, XmlBean.DataBean.ItemListBean bean){
        Intent intent=new Intent(context,VideoActivity.class);
        intent.putExtra("data",bean);
        context.startActivity(intent);
    }
    @Override
    protected int getLayout() {
        return R.layout.activity_video;
    }

    @Override
    protected int getTitleText() {
        return R.string.video_play;
    }

    @Override
    protected void initViewAndData() {
        mItemListBean = (XmlBean.DataBean.ItemListBean) getIntent().getSerializableExtra("data");
        mToobarTitleView.setTitleText(mItemListBean.getName());
        mVideoplayer.setUp(mItemListBean.getContentdat(),JCVideoPlayerStandard.SCREEN_LAYOUT_NORMAL,mItemListBean.getName());
    }

    @Override
    public void onPause() {
        super.onPause();
        JCVideoPlayer.releaseAllVideos();
    }
}
